package ModelLayer;
import java.util.ArrayList;

/**
 * A class to represent a partorder. That is hold a product and the wanted amount
 * 
 * @author Mike M. Madsen, Rasmus A. Borup
 * @version 15/12-2013
 */
public class PartOrder
{
    private int amount;
    private double totalPartOrderPrice;
    private Product product;
    /**
     * Constructor for objects of class PartOrder
     */
    public PartOrder(int amount, Product product)
    {
        this.amount = amount;
        this.product = product;
        totalPartOrderPrice = calculateTotalPartOrderPrice();
    }

    /**
     * Calculates the total price of the partorder from the price of one product and the amount
     */
    public double calculateTotalPartOrderPrice()
    {
        totalPartOrderPrice = product.getPrice() * amount;
        return totalPartOrderPrice;
    }

    /**
     * Returns a string containing details about a partorder
     */
    public String getPartOrderDetails()
    {
        String partOrderDetails = (amount + " x " + product.getProductDetails() + " Unit Price: " + product.getPrice() + " Part Total: " + totalPartOrderPrice + "\n");
        return partOrderDetails;
    }
    
    public int getAmount()
    {
    	return amount;
    }
    
    public double getPrice()
    {
    	return totalPartOrderPrice;
    }
    
    public Product getProduct()
    {
    	return product;
    }
}









